<? 
require_once("Clases/Alumno.php");
require_once("Clases/Docente.php");
include "Controladores/validaSesion.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>SRP | Nuevo Reporte</title>
		<link href="css/styles_director.css" rel="stylesheet" type="text/css" media="all" />
		<link href="font/stylesheet_tutores.css" rel="stylesheet" type="text/css" media="all" />
                <link rel="stylesheet" href="css/uniform.defaultstyle2.css" type="text/css" media="screen" />
		<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery.uniform.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" charset="utf-8">
      $(function(){
        $("input, select").uniform();
      });
    </script>
		<link rel="stylesheet" href="css/uniform.defaultstyle3.css" type="text/css" media="screen" />
                 <link rel="stylesheet" type="text/css" href="css/jquery.cleditor.css" />
                 
		<script src="YUI/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>
		<script src="YUI/2.6.0/build/calendar/calendar-min.js" type="text/javascript"></script>
		<script type="text/javascript">
 $(document).ready(function(){
     $('.ddm').hover(
	   function(){
		 $('.ddl').slideDown();
	   },
	   function(){
		 $('.ddl').slideUp();
	   }
	 );
 });
</script>
		<script type="text/javascript" src="js/DD_roundies_0.0.2a-min.js"></script>
		<script type="text/javascript">
DD_roundies.addRule('#tabsPanel', '5px 5px 5px 5px', true);

</script>
                <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
                 <script>
    $(function() {
        $( "#FechaInfraccion" ).datepicker();
    });
    
    function getTextTA(id)
            {
                id+="Frame";
                var iFrame =  document.getElementById(id);
                var iFrameBody;
                if ( iFrame.contentDocument ) 
                { // FF
                    iFrameBody = iFrame.contentDocument.getElementsByTagName('body')[0];
                }
                else if ( iFrame.contentWindow ) 
                { // IE
                    iFrameBody = iFrame.contentWindow.document.getElementsByTagName('body')[0];
                }
                return (iFrameBody.innerHTML);
                
     }
            
    
    function change(id)
      {
        var path = "images/apagado.png";
        $("#1").attr("src",path);
        $("#2").attr("src",path);
        $("#3").attr("src",path);
        switch(id)
        {
            case 1:
                $("#1").attr("src","images/verde.png");
                break;
            case 2:
                $("#2").attr("src","images/amarillo.png");
                break;
            case 3:
                $("#3").attr("src","images/rojo.png");
                break;
        }
        document.getElementById('escondido').value = (id-1);

     }
     
     function enviarReporte()
     {
        if (confirm('Estan Correctos los Datos')){
            var FechaInfraccion = document.getElementById('FechaInfraccion').value;
            if(FechaInfraccion != "Fecha Infracción"){
                var table = document.getElementById('myTable'),
                rowLength = table.rows.length
                if(rowLength > 1)
                    enviar();
                else alert("No Ha Agregado Alumnos al Reporte");
            }
            else alert("No Ha Seleccionado La Fecha de Infracción");
            
        }
     }
     
     function setR(val)
    {
        switch(parseInt(val))
                {
                    case 0:
                        document.getElementById('r0').checked = true;
                        break;
                    case 1:
                        document.getElementById('r1').checked = true;
                        break;
                    case 2:
                        document.getElementById('r2').checked = true;
                        break;
                    
                }
        
    }
    
    function getR()
    {
        if (document.getElementById('r0').checked)
            return 0;
        else if (document.getElementById('r1').checked)
            return 1;
        return 2;
    }
     
     function enviar()
     {
        var Tipo = getR();
        var FechaInfraccion = document.getElementById('FechaInfraccion').value;
        var Gravedad = document.getElementById('escondido').value;
        var Descripcion = getTextTA("input");
            
         
        var table = document.getElementById('myTable'),
        rowLength = table.rows.length

        for (var i = 1; i < rowLength; i += 1) {
            var row = table.rows[i],
                cellLength = row.cells.length   
            for (var y = 0; y < cellLength; y += 1) {
                var cell = row.cells[1];
                if(y==0)
                {
                   var Matricula = cell.innerHTML;
                   var path= "Controladores/NuevoReporte.php?Tipo="+Tipo+"&FechaInfraccion="+FechaInfraccion+"&Gravedad="+Gravedad+"&Descripcion="+Descripcion+"&Matricula="+Matricula;
                   $.ajax({
                        'url' : path,'type' : 'GET',
                        'success' : function(data) {

                        }
                    });  
                }

            }
           }
           
            limpiar();
            alert("Se ha Dado de Alta el Reporte");
            
         
     }
    function setTextTA(id,val)
            {
                id+="Frame";
                var iFrame =  document.getElementById(id);
                var iFrameBody;
                if ( iFrame.contentDocument ) 
                { // FF
                    iFrameBody = iFrame.contentDocument.getElementsByTagName('body')[0];
                }
                else if ( iFrame.contentWindow ) 
                { // IE
                    iFrameBody = iFrame.contentWindow.document.getElementsByTagName('body')[0];
                }
                iFrameBody.innerHTML = val;
                
     } 
     
    function limpiar()
    {
        setTextTA("input","");
        change(1);
        setR(0);
        clearTable("myTable");
        document.getElementById('query').value = "";
        document.getElementById('FechaInfraccion').value = "Fecha Infracción";
        
    }
    
    function removerRow(trId) {
            $(document.getElementById(trId)).remove();
    }
    
    function clearTable(table)
    {
        var tableRef = document.getElementById(table);
        while ( tableRef.rows.length > 0 )
            tableRef.deleteRow(0);
        $('#myTable > tbody:last').append('<tr><th>Nombre</th><th>Matricula</th><th>Remover</th></tr>');
    }
    
     $(function () {
    $("#1").click(function() {
        change(1);
    });
    });
     $(function () {
    $("#2").click(function() {
        change(2);
    });
    });
     $(function () {
    $("#3").click(function() {
        change(3);
    });
    });
        
    </script>
    <script type="text/javascript" src="src/jquery.autocomplete.js"></script>
    <script type="text/javascript" src="scripts/demo.js"></script>
                
		<script type="text/javascript" src="js/script-carasoul.js"></script>
		<link href="YUI/2.6.0/build/fonts/fonts-min.css" rel="stylesheet" type="text/css" />
		<link href="YUI/2.6.0/build/calendar/assets/skins/sam/calendar.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
	$(document).ready(function()
{

   $( '#checkall' ).live( 'click', function() {
				
				$( '.chkl' ).each( function() {
					$( this ).attr( 'checked', $( this ).is( ':checked' ) ? '' : 'checked' );
				}).trigger( 'change' );
 
			});
  $('#checkall').click(function(){


 $('span').toggleClass('checked');
$('#checkall').toggleClass('clicked');

 }); 
	});
		</script>
                <script type="text/javascript" src="js/jquery.cleditor.js"></script>
              
<script type="text/javascript">
      $(document).ready(function() {
        $("#input").cleditor(
        {
                width:        600, // width not including margins, borders or padding
                height:       250, // height not including margins, borders or padding
        }
      );
      });
</script>

                <script type="text/javascript">
 function re()
 {
    document.getElementById("inputFrame").style.height="200px";
 }
</script>
<script type="text/javascript">
$(window).load(function(){ document.getElementById("inputFrame").style.height="200px"; });
</script>
		</head>
		<body class="bgc" onload="re();">
                   
<input type="hidden" id="escondido" value="0"/>
<div id="admin">
          <div id="wrap">
    <div id="head">
              <h1><a href="inicioProfesor.hp">SRP<br />
                <span>Sistema Reportes Preparatoria</span></a></h1>
              <ul id="menu">
                 <li><a href="inicioDirector.php">Inicio</a></li>
                  <li><a href="#">|</a></li>
                  <li><a href="Reportes/reporteDirector.pdf">Ayuda &nbsp;&nbsp;&nbsp;&nbsp;</a></li>
                  <li><a href="#">|</a></li>
                  <li><a href="Controladores/salir.php">Salir</a></li>
              </ul>
              <ul id="tablist">
        <li><a href="#a"><span>Home</span></a></li>
      </ul>
              <div id="tabsPanel">
        <div id="a" class="tab_content">
                  <div class='carousel_container'>
            <div class='left_scroll'><img src='images/leftArrow.png' alt="" /></div>
            <div class='carousel_inner'>
                      <ul class='carousel_ul'>
                           <li title="Cargar Reportes"><a class="ico5" href='cargarReportes.php'></a></li>
               
               <li title="Nuevo Reporte"><a class="ico1" href='reporteDirector.php'></a></li>
                         <li title="Historial"><a class="ico6" href='historialDirector.php'></a></li>
                         <li title="Reportes"><a class="ico2" href='reportesDirector.php'></a></li> 
                         <li title="Inicio"><a class="ico4" href='inicioDirector.php'></a></li>
                         
              </ul>
                    </div>
            <div class='right_scroll'><img src='images/rightArrow.png' alt="" /></div>
          </div>
                </div>
        <div id="b" class="tab_content">
                  <div class='carousel_container'>
            <div class='left_scroll2'><img src='images/leftArrow.png' alt="" /></div>
           
            <div class='right_scroll2'><img src='images/rightArrow.png' alt="" /></div>
          </div>
                </div>
        <!--Tab End--> 
      </div>
              <img src="images/shadow.png" class="shadow" alt="" /> </div>
              
    <!--Content Start-->
    <div id="content">
        <div class="forms">
        <div class="heading">
            <h2>Levantar Reporte</h2>
             <div class="nueva">
                 
             <table border="1">
             <tr>
                <td>
                    <label>
                        Gravedad
                        <br></br>
                    </label>
                <label>
                </td>
             </tr>
             <tr>
                <td>
                    <img id="1" src="images/verde.png" alt="Image Button" />
                </td>
             </tr>
             <tr>
                 <td>
                    <img id="2" src="images/apagado.png" alt="Image Button"/>
                 </td>
             </tr>
             <tr>
                 <td>
                    <img id="3" src="images/apagado.png" alt="Image Button"/>
                </td>
             </tr>
             </table>
             </div>
              
             
            </div>
         <form class="styleForm">
             <div class="nueva2">
            <p>Alumno(s) 
            <input type="text" name="query" id="query"/>
           <link href="content/styles.css" rel="stylesheet" /> 
           <table id="myTable">
               <tbody>
                <th>Nombre</th>
                <th>Matricula</th>
                <th>Remover</th>
               </tbody>
            </table>
        <div id="selection"></div>

             <p>Fecha Reporte &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;Fecha Infracción<br />
                 
                 <input readonly="true" name="fr" type="text" value="<?echo date('Y-m-d H:i:s');?>" class="reg" onfocus="if(this.value=='Enter Title')this.value=''" onblur="if(this.value=='')this.value='Enter Title'" />
                 
            <input style="margin-left: 10px" name="FechaInfraccion" type="text" value="Fecha Infracción" id="FechaInfraccion" class="reg" onfocus="if(this.value=='Fecha Infracción')this.value='';"  onblur="if(this.value=='')this.value='Fecha Infracción';"  /> 
                 
          </p>
            
              <p>Tipo Reporte<br />
            <label>
                  <input type="radio" checked="true" name="RadioGroup1" value="Academico" id="r0" />
                  Académico</label>
            <label>
                  <input type="radio" name="RadioGroup1" value="Disciplinario" id="r1" />
                  Disciplinario</label>
            <label>
                  <input type="radio" name="RadioGroup1" value="Consejeria" id="r2" />
                  Consejería</label>
          </p>
            
                 <p>Descripción<br />
              
          <textarea id="input" name="input"></textarea>
             
            <p></p>
              
             <input name="save" onClick="enviarReporte();" type="button" value="Aceptar" />
             <input name="ab"   onClick="limpiar();"     type="button" value="Cancelar" />
             </div>
            </form>
      </div>
              <img src="images/sepLine.png" alt="" class="sepline" />
            
          
            </div>
  </div>
          <div class="push"></div>
        </div>
<div id="foot">
<p>© SRP</p>      
</div>
<script>
document.getElementById("inputFrame").style.height="200px";
</script>
</body>
</html>
